package com.xuetang9.t9.xinhuaxia.controller;

import com.xuetang9.t9.xinhuaxia.beans.FirstCategory;
import com.xuetang9.t9.xinhuaxia.service.IFirstCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 李亚奇
 * @version 1.0
 * @desc TODO
 * @date 2020/3/3 14:09
 * @copyright liyq
 * @address 成都西部国际金融中心2栋2201
 **/
@RestController
@RequestMapping("firstcategory")
public class FirstCategoryController {
    @Autowired
    private IFirstCategoryService firstCategoryService;

    @PostMapping("save")
    public boolean insert(@RequestBody FirstCategory firstCategory){
        boolean insert = firstCategoryService.insert(firstCategory);
        return insert;
    }
    @GetMapping("remove/{id}")
    public boolean remove(@PathVariable(value = "id",required = false) Long id){
        boolean remove = firstCategoryService.remove(id);
        return remove;
    }
    @PostMapping("update")
    public boolean update(@RequestBody FirstCategory firstCategory){
        boolean update = firstCategoryService.update(firstCategory);
        return update;
    }

    @GetMapping("list")
    public List<FirstCategory> queryAll(){
        List<FirstCategory> firstCategories = firstCategoryService.queryAll();
        return firstCategories;
    }


}
